UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oN+aOGRHVezrGmw0FL3oLrTwemu24ezXpjmkh1baIY4=' 
WHERE 
  key_id = '6ce19a1648914f1e964bdd717d58f110006f1b11ed06bc4b43138325a7dab292' 
  AND (
    token = 'oN+aOGRHVezrGmw0FL3oLrTwemu24ezXpjmkh1baIY4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041