UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tAdfjG7m/BW2z5RhgJdKkTKBCXIAmwzJwhjxnMxDs14='
WHERE
key_id = '964b13a477791b62f8d9c18c84f3492db13dedf3afa32a36f029642a3c0ae4b3'
AND (
token = 'tAdfjG7m/BW2z5RhgJdKkTKBCXIAmwzJwhjxnMxDs14='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)