UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ViC3soEkRzThIIqoE/tyZO/GHXXlBuVeXwgVeMfF+/Q=' 
WHERE 
  key_id = '5809a4c7329e41c008ebaa1d38c096e459f5d7189b9d42b4927e20dc52528fb5' 
  AND (
    token = 'ViC3soEkRzThIIqoE/tyZO/GHXXlBuVeXwgVeMfF+/Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029