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

Query time 0.00091