UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pa85sbPvHuOjOLXTB9RvxSCOSqulJwopfKnI1488+iI=' 
WHERE 
  key_id = '8ce4c71099ee1eaec603f0cbaf0260194aa367f85cd91b51007522b82e5b2bc7' 
  AND (
    token = 'Pa85sbPvHuOjOLXTB9RvxSCOSqulJwopfKnI1488+iI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019