UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6rUPjqdyyovaPXfNV8TYaPLAvLbebwYnjZ2rxCjUmEE='
WHERE
key_id = 'f38d5df953593a0845aac1a1b4875ff7ba7ccd75362881de5aaebb672df40d4a'
AND (
token = '6rUPjqdyyovaPXfNV8TYaPLAvLbebwYnjZ2rxCjUmEE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)