UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6Bc34Lt6tpOkrmXy9uK3Oaj2anAQqfEuxGSsQ9u1q8Q=' 
WHERE 
  key_id = '31b0894f3beced0188f076957eccbd53b966f87dadcf714254eca32d21616657' 
  AND (
    token = '6Bc34Lt6tpOkrmXy9uK3Oaj2anAQqfEuxGSsQ9u1q8Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037