UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OhZQKrMVtzYSV9dPFBSk5P1iCfH6qJ+iJ1IP5vX6nXc=' 
WHERE 
  key_id = '78c1305c5bf0bdcd1a81c056991184839e69dbd57cb11b935a8620e64026068c' 
  AND (
    token = 'OhZQKrMVtzYSV9dPFBSk5P1iCfH6qJ+iJ1IP5vX6nXc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038