UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '98GtFJRLh0i7RvNV7+U1eIzcTggNUbxicdczJqZ2XTk='
WHERE
key_id = 'cd7a93c0340c62d1560f3a0e71756cb7e054df262b50dbf454d550ea6de15ad6'
AND (
token = '98GtFJRLh0i7RvNV7+U1eIzcTggNUbxicdczJqZ2XTk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)