UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wwrqp/AMsnEFmPWGhFa7VNrl17pTumsaV8gU8f8p0QQ=' 
WHERE 
  key_id = '20e2c80236c0f1e5b287483eeb68a9c185aeb8fb90edf32096ee6f167e41f59a' 
  AND (
    token = 'wwrqp/AMsnEFmPWGhFa7VNrl17pTumsaV8gU8f8p0QQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028