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

Query time 0.00040