UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '64f/rYfkcjJfk5Kbok1KbNZXv1ul/FVMNsdq3Dgmb2w='
WHERE
key_id = 'd6326d8c1b8e383b2832474621e619dec8887af40daf54af32a06872fc69c340'
AND (
token = '64f/rYfkcjJfk5Kbok1KbNZXv1ul/FVMNsdq3Dgmb2w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)