UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xYXfSMV/vYr4KO0fKN6Nipzy+SKmYwpMEU7VzChwMmg=' 
WHERE 
  key_id = '4961201b8e342e125cde1d36bfa439d9c12bac9648661e0258933680b2474c7d' 
  AND (
    token = 'xYXfSMV/vYr4KO0fKN6Nipzy+SKmYwpMEU7VzChwMmg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035