UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CQUTjJaQAZ2+rtsuGySycYcACX+Z3VPEHm7NkKRy2V4='
WHERE
key_id = '1e16efbc466721ab99473721e288d7c880ef67bb4d5b882bcabdcb9dde108a7b'
AND (
token = 'CQUTjJaQAZ2+rtsuGySycYcACX+Z3VPEHm7NkKRy2V4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)