UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'upJgubqpofBahmlGEH5GL8k2uXnORTpYLcbAYujq8kw=' 
WHERE 
  key_id = '8880989d31e4665836f5af5f55d317ebe2db3f7ae603ac015b402eebf838557b' 
  AND (
    token = 'upJgubqpofBahmlGEH5GL8k2uXnORTpYLcbAYujq8kw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062