UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0KraTe1vUBVRskiWBvyiS2EP6KhqHrDTQHENVQKbc/w='
WHERE
key_id = 'b3d56beb940fb86d8141273266eb36688d3863307ac3a3aeb15eabb4bb228fbc'
AND (
token = '0KraTe1vUBVRskiWBvyiS2EP6KhqHrDTQHENVQKbc/w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)