UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'An+V58WZU0ubcI+EPvJOglqbCQJlxTOpeNLmwDVUIV0=' 
WHERE 
  key_id = '7aa8e4060dddcb85566cf732a5ebc078e734914f53eadaca35ccdf0bebecbf66' 
  AND (
    token = 'An+V58WZU0ubcI+EPvJOglqbCQJlxTOpeNLmwDVUIV0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034