UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GIwfJoiS1rAzLwEGMbMmvw5F8cixHTnqWQ+GtOw8j40=' 
WHERE 
  key_id = '13fccb9270f5a81ed1ec46f061eaf9fda53f99115232c23fdab5b60d613a5664' 
  AND (
    token = 'GIwfJoiS1rAzLwEGMbMmvw5F8cixHTnqWQ+GtOw8j40=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045