UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IvkjKTI10lBn5VfGeiRICSfFfj50icFNzJ/SFf49lxk='
WHERE
key_id = '1b5650be4fd599a542c528bba1179ba26bb9ff228454ee0f9a39da5c9ae9ce3f'
AND (
token = 'IvkjKTI10lBn5VfGeiRICSfFfj50icFNzJ/SFf49lxk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)