UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7egCh4/JcV5HTjhtPc01yM0lN0nJXntF+Xyw4pPv6CI='
WHERE
key_id = '412ec14f0fcb9619464bf8257a4369b82986ad47ed2ce9f9fd5fe35fd3574fac'
AND (
token = '7egCh4/JcV5HTjhtPc01yM0lN0nJXntF+Xyw4pPv6CI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)