UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LMN+gATZXsceFMm8Sg3Amrj4wm6NC8hcydP/INDte4g=' 
WHERE 
  key_id = '3a36a1a8b7499f6b44377c24bb3f881ea2081a85f978463711ab801a91828348' 
  AND (
    token = 'LMN+gATZXsceFMm8Sg3Amrj4wm6NC8hcydP/INDte4g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029