UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CqObDGHMaICooY2KSVPz+m10UGknhZ9313WkthOCRLI=' 
WHERE 
  key_id = 'b0fa50a0069c48b39332908b163322a009565802362a0f7569fbef64b4afc071' 
  AND (
    token = 'CqObDGHMaICooY2KSVPz+m10UGknhZ9313WkthOCRLI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051