UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'brKqrqA5CfrPSRQ+R+ArcUZU9OqUYW1uqfat5BkLhLk='
WHERE
key_id = 'ae0e0749ab10ab48195269ee23eb1b12476d320222c7bb37c1492ed9a32522e9'
AND (
token = 'brKqrqA5CfrPSRQ+R+ArcUZU9OqUYW1uqfat5BkLhLk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)