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

Query time 0.00039