UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h+YXTWulscqKcyEv4FwD94S45L9Ix9fpPCb3bRdmvB4='
WHERE
key_id = '7bc0fa9b8afc3b72fb30dcaeb07e16ac2a1838f9ae52f8452344db89361c8a8b'
AND (
token = 'h+YXTWulscqKcyEv4FwD94S45L9Ix9fpPCb3bRdmvB4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)