UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S/hztA9rWRBja8bckTYhapZTfcrIDsJJNXtHp43kt+8='
WHERE
key_id = '1109a5cd7447ff9f086252815d6d9d064d4ba8a92944ec304d82a0e4fadb72c9'
AND (
token = 'S/hztA9rWRBja8bckTYhapZTfcrIDsJJNXtHp43kt+8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)