UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dzy6a22ADe8NN37JFwPgkC5LIYKq9kRFgyoCHWssB5k=' 
WHERE 
  key_id = '7a93e913cf79bd9518029c048e714076bb17d7a086caaf4cdcbede2697925d9d' 
  AND (
    token = 'dzy6a22ADe8NN37JFwPgkC5LIYKq9kRFgyoCHWssB5k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021