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

Query time 0.00033