UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z2aPX4QEzwfKvFwQrIkiVc4G5Y6Mmu9XTOKqNAveTj0='
WHERE
key_id = '85abd88f323e184971da547fed81b69899d680871b19a5bd7429c25b7bda4382'
AND (
token = 'Z2aPX4QEzwfKvFwQrIkiVc4G5Y6Mmu9XTOKqNAveTj0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)