UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bCxpJYW0CKW2RP4SQTSf6Ypw4T0OTLSvjlUeLByzo5Q=' 
WHERE 
  key_id = 'f5de0822c816fe7bc543255ba3342c521830c7a56292fcc986b40bed4811e338' 
  AND (
    token = 'bCxpJYW0CKW2RP4SQTSf6Ypw4T0OTLSvjlUeLByzo5Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056